<?php
try {
    define('APP_PATH', dirname(__DIR__) . '/app');
    $config = require APP_PATH . '/config/config.php';
    $loader = new Phalcon\Loader();
    $loader->registerNamespaces(array_merge(
        require dirname(dirname(__DIR__)) . '/xinhehui_base/loader.php',
        require APP_PATH . '/config/loader.php'
    ));
    $loader->register();
    $app = new \site\App();
    $app->run($config);
} catch (Exception $exc) {
    header('Location:'.$_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].'/public/error');
}
